package org.yzl.designPatterns.iterator.impl;

import org.yzl.designPatterns.iterator.ICollection;
import org.yzl.designPatterns.iterator.IIterator;

public class CollectionImpl implements ICollection {

    public Object objects[];

    public CollectionImpl(Object objects[]){
        this.objects = objects;
    }

    @Override
    public IIterator iterator() {
        return new IteratorImpl(this);
    }

    @Override
    public Object get(int i) {
        return objects[i];
    }

    @Override
    public int size() {
        return objects.length;
    }
}
